// const workercode = function() {

//     self.postMessage({
//         action: 'updateTime',
//         time: new Date(Date.now() + 8 * 60 * 60 * 1000).toJSON().substr(0, 19).replace('T', ' ')
//     }, 'timer')

//     self.onmessage = (eve) => {
//         console.log(eve)
//     }
// }

// let code = workercode.toString()
// code = code.substring(code.indexOf('{') + 1, code.lastIndexOf('}'))

// const blob = new Blob([code], { type: 'application/javascript' })

// const workscript = window.URL.createObjectURL(blob)

// export default workscript


export default class WebWorker {
    constructor(worker) {
        const code = worker.toString();
        const blob = new Blob(["(" + code + ")()"]);
        return new Worker(URL.createObjectURL(blob));
    }
}